#ifndef AUTHCONTROLLER_H
#define AUTHCONTROLLER_H

#include <QObject>
#include "databasemanager.h"

class AuthController : public QObject
{
    Q_OBJECT
public:
    explicit AuthController(DatabaseManager *databaseManager, QObject *parent = nullptr);

    void checkUserAuthority(const QString& userId);

    // 属性
    bool isAdmin() const { return m_isAdmin; }
    QString userId() const { return m_userId; }
    QString userName() const { return m_userName; }

signals:
    void authorityChanged(bool isAdmin);
    void userInfoLoaded();

private:
    bool m_isAdmin = false;
    QString m_userId;
    QString m_userName;

    DatabaseManager *m_databaseManager;
};

#endif // AUTHCONTROLLER_H
